package service;

import model.User;
import exceptions.UserNotFoundException;

/**
 * Class that manipulates the login and password of the user.
 * @author Andre Melo
 * @author Marcus Leite 
 * @author Sergio Danilo
 *
 */
public class LoginServiceImpl implements LoginService{

	/*
	 * The instance of UserService.
	 */
	private UserService userService;
	
	@Override
	public UserService getUserService() {
		return userService;
	}

	@Override
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	@Override
	public boolean validation(String login, String psswd) throws UserNotFoundException {
		User user = userService.findByEmail(login);
		return user.getPassword().equals(psswd);
	}
	
	
}
